[HVM] Fix an issue with APIC priority checks.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 2 Aug 2006 09:04:27 +0000 (10:04 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 2 Aug 2006 09:04:27 +0000 (10:04 +0100)
Signed-off-by; Yunhong Jiang <yunhong.jiang@intel.com>

xen/arch/x86/hvm/vlapic.c

index 900a98e485a35aa4bd1afc2414a1d0fc690cb959..1257d592beff6fd4affe19a98eee38c984d35e2b 100644 (file)
@@ -210,7 +210,7 @@ static int vlapic_accept_irq(struct vcpu *v, int delivery_mode,
         if ( unlikely(vlapic == NULL || !vlapic_enabled(vlapic)) )
             break;
 
-        if ( test_and_set_bit(vector, &vlapic->irr[0]) )
+        if ( test_and_set_bit(vector, &vlapic->irr[0]) && level)
         {
             HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
               "level trig mode repeatedly for vector %d\n", vector);
@@ -922,7 +922,8 @@ int cpu_get_apic_interrupt(struct vcpu *v, int *mode)
     {
         int highest_irr = vlapic_find_highest_irr(vlapic);
 
-        if ( highest_irr != -1 && highest_irr >= vlapic->processor_priority )
+        if ( highest_irr != -1 &&
+             ( (highest_irr & 0xF0) > vlapic->processor_priority ) )
         {
             if ( highest_irr < 0x10 )
             {
@@ -952,7 +953,8 @@ int cpu_has_apic_interrupt(struct vcpu* v)
     if (vlapic && vlapic_enabled(vlapic)) {
         int highest_irr = vlapic_find_highest_irr(vlapic);
 
-        if (highest_irr != -1 && highest_irr >= vlapic->processor_priority) {
+        if ( highest_irr != -1 &&
+             ( (highest_irr & 0xF0) > vlapic->processor_priority ) ) {
             return 1;
         }
     }